package com.zaicheng.cloud.remotecall;
/**
 @author zaicheng
 @version 1.0
 @date 2022-04-19
 @email zzc15847256473@163.com
 */

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Map;

public interface InvocationHandlerFactory {

    InvocationHandler create(Target t1, Map<Method,InvocationHandlerFactory.MethodHandler> methodHandlerMap);

    public  static  final  class  Default implements InvocationHandlerFactory{

        public Default() {
        }

        @Override
        public InvocationHandler create(Target t1, Map<Method, MethodHandler> methodHandlerMap) {
            return new ReflectiveRemoteCall.RemoteCallInvocationHandler(t1,methodHandlerMap);
        }
    }

    public interface MethodHandler{
        Object invoke(Target target,Method method,Object[] args);
    }


}
